//
//  UIButton+Extension.swift
//  Micro-blog Sina
//
//  Created by admin on 16/3/26.
//  Copyright © 2016年 admin. All rights reserved.
//

import UIKit

extension UIButton {
    /**
     Create button
     
     - parameter title:               title description
     - parameter imageName:           imageName description
     - parameter backgroundImageName: backgroundImageName description
     - parameter textColor:           textColor description
     - parameter textFont:            textFont description
     
     - returns: button
     */
    convenience init(title: String, imageName: String, backgroundImageName: String = "timeline_card_bottom_background", textColor: UIColor = UIColor.lightGrayColor(), textFont: CGFloat = HJStatusCellBottomDefaultFontSize) {
        self.init()
        self.setBackgroundImage(UIImage(named: backgroundImageName), forState: UIControlState.Normal)
        self.setBackgroundImage(UIImage(named: "\(backgroundImageName)_highlighted"), forState: UIControlState.Highlighted)
        self.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(textColor, forState: UIControlState.Normal)
        self.titleLabel?.font = UIFont.systemFontOfSize(textFont)
    }
}